// import android.text.TextUtils;

import javafx.util .Pair;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

/* renamed from: arf */
public class arf  {

    static Boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }
    /* renamed from: a */
    private static final Charset f3024a = Charset.forName("UTF-8");

    /* renamed from: a */
    private Pair<byte[], byte[]> m4501a(String str) {
        if (this.isEmpty(str) || str.length() < 32) {
            return new Pair<>(new byte[0], new byte[0]);
        }
        return new Pair<>(this.m4515a(str.substring(0, 32)), this.m4515a(str.substring(32)));
    }

     

    /* renamed from: a */
    private String m4504a(byte[] bArr, byte[] bArr2, byte[] bArr3) {
        String str;
        if (bArr.length == 0 || bArr2.length == 0 || bArr3.length == 0) {
            System.out.println("decrypt: parameter exception");
            return "";
        }
        try {
            Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding");
            instance.init(2, new SecretKeySpec(bArr, "AES"), new IvParameterSpec(bArr2));
            return new String(instance.doFinal(bArr3), f3024a);
        } catch (NoSuchAlgorithmException unused) {
            str = "aesDecrypt(): getInstance - No such algorithm,transformation";
            System.out.println(str);
            return "";
        } catch (InvalidKeyException unused2) {
            str = "aesDecrypt(): init - Invalid key!";
            System.out.println(str);
            return "";
        } catch (InvalidAlgorithmParameterException unused3) {
            str = "aesDecrypt(): init - Invalid algorithm parameters !";
            System.out.println(str);
            return "";
        } catch (NoSuchPaddingException unused4) {
            str = "aesDecrypt():  No such filling parameters ";
            System.out.println(str);
            return "";
        } catch (BadPaddingException unused5) {
            str = "aesDecrypt(): False filling parameters!";
            System.out.println(str);
            return "";
        } catch (IllegalBlockSizeException unused6) {
            str = "aesDecrypt(): doFinal - The provided block is not filled with";
            System.out.println(str);
            return "";
        }
    }
 
    private static byte m4511a(char c) { 
            return (byte) "0123456789ABCDEF".indexOf(c);
        }

    public static byte[] m4515a(String str) {

        String upperCase = str.toUpperCase(Locale.ENGLISH);
        int length = upperCase.length() / 2;
        char[] charArray = upperCase.toCharArray();
        byte[] bArr = new byte[length];
        for (int i = 0; i < length; i++) {
            int i2 = i * 2;
            bArr[i] = (byte) (m4511a(charArray[i2 + 1]) | (m4511a(charArray[i2]) << 4));
        }
        return bArr;
    }

    /* renamed from: a */
    public String mo5860a(String str, String str2) {
        if (this.isEmpty(str2) || this.isEmpty(str)) {
            System.out.println("decrypt: content or key is empty");
            return "";
        }
        byte[] a = this.m4515a(str);
        Pair<byte[], byte[]> a2 = m4501a(str2);
        return m4504a(a, (byte[]) a2.getKey(), (byte[]) a2.getValue());
    }

    public static void main(String[] args){
        arf f = new arf();
        System.out.println(f.mo5860a("f6040d0e807aaec325ecf44823765544e92905158169f694b282bf17388632cf95a83bae7d2d235c1f039b0df1dcca5fda619b6f7f459f2ff8d70ddb7b601592fe29fcae58c028f319b3b12495e67aa5390942a997a8cb572c8030b2df5c2b622608bea02b0c3e5d4dff3f72c9e3204049a45c0760cd3604af8d57f0e0c693cc", "iIGzz4HW+1TyWeS1EOskLqShX8nAHRBrv3ukuGcRtRJHOV9/OUgPHzhfGQV9dU3tk/1/xgqAntkndIiYLdGNh8DBCbBCltTw2AGQURu45S4tN4lUghYBQXRwfnpEIzEVCgWFscFC0xNVRSMl6aPIp9OEWMbUvBlpV5wNx/4vlY4="));
    }
}
